﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;


namespace IHISCETeim.Web.MachineSys.PartsModel
{
    public partial class PartsDebtlLookUpList : PageBase
    {
        #region 属性 (查询条件)

        /// <summary>
        /// 排序字段 值为 id
        /// </summary>
        protected override string orderField
        {
            get
            {
                return GetRequestValue<string>("orderField", "SaleDate");
            }
        }
        /// <summary>
        ///  排序方式 desc或 asc
        /// </summary>
        protected override string orderDirection
        {
            get
            {
                return GetRequestValue<string>("orderDirection", "ASC");
            }
        }
        protected override string SQLSort
        {
            get
            {
                return (" DueDate ASC," + (orderField + " " + orderDirection) + " ");
            }
        }

        [QueryColumnName(), QueryOperator(QueryOperatorsEnum.等于)]
        public string CardCode
        {
            get
            {
                return GetRequestValue<string>("CardCode");

            }
        }
        [QueryColumnName(), QueryOperator(QueryOperatorsEnum.包含)]
        public string Comments
        {
            get
            {
                return GetRequestValue<string>("Comments", "");
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
        }

        protected void DataBind()
        {
            this.rpMenu.DataSource = PartsDebtController.GetPagination(GetSQLWhere(), pageNum, numPerPage, SQLSort, ref TotalCount)[0];
            this.rpMenu.DataBind();
        }

        protected string GetSQLWhere()
        {
            string sqlwhere = QueryFiledHelper.GetSqlWhere(this);

            if (!string.IsNullOrEmpty(sqlwhere))
            {
                sqlwhere += " and [State]=0 ";
            }
            else
            {
                sqlwhere = " [State]=0 ";
            }
            return sqlwhere;
        }


        protected override string DWZRef
        {
            get { return ""; }
        }
    }
}